package util;

/**
 * 力扣单向链表
 */
public class ListNode {
    public int val;
    public ListNode next;

    public ListNode(int x) {
        val = x;
        next = null;
    }

    public void list() {
        if (this != null) {
            ListNode next = this.next;
            while (next != null) {
                System.out.println(next.val);
                next = next.next;
            }
        }
    }
}
